const express = require('express')
const router = express.Router()
const books = require('../../controller/books.controller')

/**
 * @swagger
 * /books:
 *    get:
 *      tags:
 *      - 书签
 *      summary: 获取所有书签
 *      produces:
 *      - application/json
 *      parameters:
 *      - name: page
 *        in: query
 *        description: 页码
 *        required: false
 *        type: string
 *      - name: limit
 *        in: query
 *        description: 每页数量
 *        required: false
 *        type: string
 */
router.get('/books', books.getBooks)

/**
 * @swagger
 * /books/add:
 *    post:
 *      tags:
 *      - 书签
 *      summary: 添加书签
 *      produces:
 *      - application/json
 *      parameters:
 *      - name: book_url
 *        in: query
 *        description: 书签地址
 *        required: true
 *        type: string
 *      - name: book_name
 *        in: query
 *        description: 书签名称
 *        required: true
 *        type: string
 *      - name: book_desc
 *        in: query
 *        description: 书签描述
 *        required: false
 *        type: string
 *      - name: status
 *        in: query
 *        description: 书签状态
 *        required: true
 *        type: string
 *      - name: books_id
 *        in: query
 *        description: 书签列表id
 *        required: true
 *        type: string
 */
router.post('/books/add', books.addBooks)

/**
 * @swagger
 * /books/update:
 *    patch:
 *      tags:
 *      - 书签
 *      summary: 修改书签
 *      produces:
 *      - application/json
 *      parameters:
 *      - name: book_id
 *        in: query
 *        description: 书签id
 *        required: true
 *        type: string
 *      - name: book_url
 *        in: query
 *        description: 书签地址
 *        required: true
 *        type: string
 *      - name: book_name
 *        in: query
 *        description: 书签名称
 *        required: true
 *        type: string
 *      - name: book_desc
 *        in: query
 *        description: 书签描述
 *        required: true
 *        type: string
 *      - name: status
 *        in: query
 *        description: 书签状态 1 公开 | 0 私有
 *        required: true
 *        type: string
 *      - name: books_id
 *        in: query
 *        description: 书签列表id
 *        required: true
 *        type: string
 */
router.patch('/books/update', books.updateBooks)

/**
 * @swagger
 * /books/delete:
 *    delete:
 *      tags:
 *      - 书签
 *      summary: 删除书签
 *      produces:
 *      - application/json
 *      parameters:
 *      - name: book_id
 *        in: query
 *        description: 书签id
 *        required: true
 *        type: string
 */
router.delete('/books/delete', books.deleteBooks)

module.exports = router
